/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-08-07
 * Time:16:53
 */
public class Test {
    public int countSegments(String s) {
        int len=s.length();
        if(len==0){
            return 0;
        }
        int count=0;
        String[] ss=s.split(" ");
        for(String r:ss){
            if(r.length()!=0){
                count++;
            }
        }
        return ss.length;
    }
}
